package com.lagou.wuxi.springboottest.service;

import com.lagou.wuxi.springboottest.entity.Blog;
import com.lagou.wuxi.springboottest.repository.BlogRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {

    @Autowired
    private BlogRepository blogRepository;

    public Page<Blog> page(int page, int limit){
        Pageable pageable = PageRequest.of(page, limit);
        return blogRepository.findAll(pageable);
    }
}
